﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

namespace Common
{
    public sealed class EncryptPassword
    {
        private EncryptPassword()
        {
            //Todo code here
        }
        /// <summary>
        /// Mã hóa MD5.
        /// </summary>
        /// <param name="inPassword">Mật khẩu.</param>
        /// <returns></returns>
        public static String MD5Encrypt(String inPassword)
        {
            MD5CryptoServiceProvider md5Crypto = new MD5CryptoServiceProvider();
            byte[] hashArray;
            UTF8Encoding encoding = new UTF8Encoding();
            hashArray = md5Crypto.ComputeHash(encoding.GetBytes(inPassword));
            String passHashed = Convert.ToBase64String(hashArray);
            return passHashed;
        }
    }
}
